package LinkData;

public class LinkedNode {
    //创建头节点
    private Node head = new Node(0, "");

    //拉手 方法
    public void add(Node a) {
        Node temp = head;
        while (true)//从头遍历 遍历到尾节点
        {
            if (temp.next == null) {
                break;
            }
            temp = temp.next;//向后应用
        }
        temp.next = a;
    }

    /**
     * 打印输出
     */
    public void show() {
        if (head.next == null) {
            System.out.println("链表为空");
            return;
        }
        Node temp = head.next;//指向第2个
        while (temp.next != null) {
            System.out.print(temp + "-->");
            temp = temp.next;//向后应用
        }
        System.out.println(temp);

    }


}
